翻訳と辞書
Words near each other
・ J & J
・ J & J Snack Foods
・ J & J Ultralights
・ J & J Ultralights Seawing
・ J & J Ultralights Tukan
・ J & L Randall
・ J & P Coats
・ J & S Building
・ J & S Records
・ J & W Dudgeon
・ J & W Van Duzen & Company
・ J (disambiguation)
・ J (Japanese musician)
・ J (Los Angeles Railway)
・ J (novel)
J (programming language)
・ J (Sidi Rezegh) Battery Royal Horse Artillery
・ J (South Korean singer)
・ J (text editor)
・ J A Pye (Oxford) Ltd v Graham
・ J Album
・ J Allard
・ J Alvarez
・ J Alvarez discography
・ J and B v Director General, Department of Home Affairs
・ J and Friends Sing and Chant for Amma
・ J Anthony Allen
・ J Anthony Crane
・ J Archdale
・ J Ariadhitya Pramuhendra


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

J (programming language) : ウィキペディア英語版
J (programming language)

The J programming language, developed in the early 1990s by Kenneth E. Iverson and Roger Hui,〔(A Personal View of APL ), 1991 essay by K.E. Iverson (archived link)〕〔(Overview of J history ) by Roger Hui (19 March 2002)〕 is a synthesis of APL (also by Iverson) and the FP and FL function-level languages created by John Backus.
To avoid repeating the APL special-character problem, J requires only the basic ASCII character set, resorting to the use of the dot and colon as "inflections"〔(J Dictionary: I. Alphabet and Words )〕 to form short words similar to ''digraphs''. Most such "primary" (or "primitive") J words serve as mathematical symbols, with the dot or colon extending the meaning of the basic characters available. Additionally, many characters which might need to be balanced in other languages (such as
==Examples==
J permits point-free style and function composition. Thus, its programs can be very terse and are considered difficult to read by some programmers.
The hello world program in J is
'Hello, world!'
This implementation of hello world reflects the traditional use of J – programs are entered into a J interpreter session, and the results of expressions are displayed. It's also possible to arrange for J scripts to be executed as standalone programs. Here's how this might look on a UNIX system:

#!/bin/jc
echo 'Hello, world!'
exit ''

Historically, APL used / to indicate the fold, so +/1 2 3 was equivalent to 1+2+3. Meanwhile, division was represented with the classic mathematical division symbol (the obelus, ÷), which was implemented by overstriking a minus sign and a colon (on both EBCDIC and ASCII paper terminals). Because ASCII in general does not support overstrikes in a device-independent way, and does not include a division symbol per se, J uses % to represent division, as a visual approximation or reminder. (This illustrates something of the mnemonic character of J's tokens, and some of the quandaries imposed by the use of ASCII.)
The following defines a J function named "avg" to calculate the average of a list of numbers:
avg=: +/ % #
This is a test execution of the function:
avg 1 2 3 4
2.5
# counts the number of items in the array. +/ sums the items
of the array. % divides the sum by the number of items. Note: ''avg'' is defined above using a train of three verbs ("+/", "%", and "#") known as a fork. Specifically (V0 V1 V2) Ny is the same as (V0(Ny)) V1 (V2(Ny)) which shows some of the power of J. (Here V0, V1, and V2 denote verbs and Ny denotes a noun.)
Some examples of using avg :
v=: ?. 20 $100 NB. a random vector
v
46 55 79 52 54 39 60 57 60 94 46 78 13 18 51 92 78 60 90 62
avg v
59.2
4 avg\ v NB. moving average on periods of size 4
58 60 56 51.25 52.5 54 67.75 64.25 69.5 57.75 38.75 40 43.5 59.75 70.25 80 72.5
m=: ?. 4 5 $50 NB. a random matrix
m
46 5 29 2 4
39 10 7 10 44
46 28 13 18 1
42 28 10 40 12

avg"1 m NB. apply avg to each rank 1 subarray (each row) of m
17.2 22 21.2 26.4
Rank is a crucial concept in J. Its significance in J is similar to the significance of "select" in SQL and of "while" in C.
Here is an implementation of quicksort, from the J Dictionary:

sel=: adverb def 'u # ['

quicksort=: verb define
if. 1 >: #y do. y
else.
(quicksort y sel e=.y{~?#y
end.
)

The following is an implementation of quicksort demonstrating tacit programming. Tacit programming involves composing functions together and not referring explicitly to any variables. J's support for ''forks'' and ''hooks'' dictates rules on how arguments applied to this function will be applied to its component functions.

quicksort=: (($:@(<#[), (=#[), $:@(>#[)) ({~ ?@#)) ^: (1<#)

Sorting in J is usually accomplished using the built-in (primitive) verbs /: (Sort Up) and \: (Sort Down). User-defined sorts such as quicksort, above, typically are for illustration only.
The following expression exhibits pi with n digits and demonstrates the extended precision capabilities of J:
n=: 50 NB. set n as the number of digits required
<.@o. 10x^n NB. extended precision 10 to the nth
* pi

314159265358979323846264338327950288419716939937510

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「J (programming language)」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.